\(\int \frac {(d+e x) (a+b \log (c x^n))^2}{x^2} \, dx\) [80]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 72 \[ \int \frac {(d+e x) \left (a+b \log \left (c x^n\right )\right )^2}{x^2} \, dx=-\frac {2 b^2 d n^2}{x}-\frac {2 b d n \left (a+b \log \left (c x^n\right )\right )}{x}-\frac {d \left (a+b \log \left (c x^n\right )\right )^2}{x}+\frac {e \left (a+b \log \left (c x^n\right )\right )^3}{3 b n} \]

[Out]

-2*b^2*d*n^2/x-2*b*d*n*(a+b*ln(c*x^n))/x-d*(a+b*ln(c*x^n))^2/x+1/3*e*(a+b*ln(c*x^n))^3/b/n

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {2395, 2342, 2341, 2339, 30} \[ \int \frac {(d+e x) \left (a+b \log \left (c x^n\right )\right )^2}{x^2} \, dx=-\frac {d \left (a+b \log \left (c x^n\right )\right )^2}{x}-\frac {2 b d n \left (a+b \log \left (c x^n\right )\right )}{x}+\frac {e \left (a+b \log \left (c x^n\right )\right )^3}{3 b n}-\frac {2 b^2 d n^2}{x} \]

[In]

Int[((d + e*x)*(a + b*Log[c*x^n])^2)/x^2,x]

[Out]

(-2*b^2*d*n^2)/x - (2*b*d*n*(a + b*Log[c*x^n]))/x - (d*(a + b*Log[c*x^n])^2)/x + (e*(a + b*Log[c*x^n])^3)/(3*b
*n)

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2339

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/(x_), x_Symbol] :> Dist[1/(b*n), Subst[Int[x^p, x], x, a + b*L
og[c*x^n]], x] /; FreeQ[{a, b, c, n, p}, x]

Rule 2341

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Log[c*x^
n])/(d*(m + 1))), x] - Simp[b*n*((d*x)^(m + 1)/(d*(m + 1)^2)), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[m, -1
]

Rule 2342

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Lo
g[c*x^n])^p/(d*(m + 1))), x] - Dist[b*n*(p/(m + 1)), Int[(d*x)^m*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{
a, b, c, d, m, n}, x] && NeQ[m, -1] && GtQ[p, 0]

Rule 2395

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((f_.)*(x_))^(m_.)*((d_) + (e_.)*(x_)^(r_.))^(q_.), x_Symbol]
:> With[{u = ExpandIntegrand[(a + b*Log[c*x^n])^p, (f*x)^m*(d + e*x^r)^q, x]}, Int[u, x] /; SumQ[u]] /; FreeQ[
{a, b, c, d, e, f, m, n, p, q, r}, x] && IntegerQ[q] && (GtQ[q, 0] || (IGtQ[p, 0] && IntegerQ[m] && IntegerQ[r
]))

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {d \left (a+b \log \left (c x^n\right )\right )^2}{x^2}+\frac {e \left (a+b \log \left (c x^n\right )\right )^2}{x}\right ) \, dx \\ & = d \int \frac {\left (a+b \log \left (c x^n\right )\right )^2}{x^2} \, dx+e \int \frac {\left (a+b \log \left (c x^n\right )\right )^2}{x} \, dx \\ & = -\frac {d \left (a+b \log \left (c x^n\right )\right )^2}{x}+\frac {e \text {Subst}\left (\int x^2 \, dx,x,a+b \log \left (c x^n\right )\right )}{b n}+(2 b d n) \int \frac {a+b \log \left (c x^n\right )}{x^2} \, dx \\ & = -\frac {2 b^2 d n^2}{x}-\frac {2 b d n \left (a+b \log \left (c x^n\right )\right )}{x}-\frac {d \left (a+b \log \left (c x^n\right )\right )^2}{x}+\frac {e \left (a+b \log \left (c x^n\right )\right )^3}{3 b n} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.88 \[ \int \frac {(d+e x) \left (a+b \log \left (c x^n\right )\right )^2}{x^2} \, dx=-\frac {d \left (a+b \log \left (c x^n\right )\right )^2}{x}+\frac {e \left (a+b \log \left (c x^n\right )\right )^3}{3 b n}-\frac {2 b d n \left (a+b n+b \log \left (c x^n\right )\right )}{x} \]

[In]

Integrate[((d + e*x)*(a + b*Log[c*x^n])^2)/x^2,x]

[Out]

-((d*(a + b*Log[c*x^n])^2)/x) + (e*(a + b*Log[c*x^n])^3)/(3*b*n) - (2*b*d*n*(a + b*n + b*Log[c*x^n]))/x

Maple [A] (verified)

Time = 0.17 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.58

method result size
parallelrisch \(\frac {e \,b^{2} \ln \left (c \,x^{n}\right )^{3} x +3 \ln \left (x \right ) x \,a^{2} e n +3 a b e \ln \left (c \,x^{n}\right )^{2} x -3 \ln \left (c \,x^{n}\right )^{2} b^{2} d n -6 \ln \left (c \,x^{n}\right ) b^{2} d \,n^{2}-6 b^{2} d \,n^{3}-6 \ln \left (c \,x^{n}\right ) a b d n -6 a b d \,n^{2}-3 a^{2} d n}{3 x n}\) \(114\)
risch \(\text {Expression too large to display}\) \(1544\)

[In]

int((e*x+d)*(a+b*ln(c*x^n))^2/x^2,x,method=_RETURNVERBOSE)

[Out]

1/3/x*(e*b^2*ln(c*x^n)^3*x+3*ln(x)*x*a^2*e*n+3*a*b*e*ln(c*x^n)^2*x-3*ln(c*x^n)^2*b^2*d*n-6*ln(c*x^n)*b^2*d*n^2
-6*b^2*d*n^3-6*ln(c*x^n)*a*b*d*n-6*a*b*d*n^2-3*a^2*d*n)/n

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 149 vs. \(2 (70) = 140\).

Time = 0.28 (sec) , antiderivative size = 149, normalized size of antiderivative = 2.07 \[ \int \frac {(d+e x) \left (a+b \log \left (c x^n\right )\right )^2}{x^2} \, dx=\frac {b^{2} e n^{2} x \log \left (x\right )^{3} - 6 \, b^{2} d n^{2} - 3 \, b^{2} d \log \left (c\right )^{2} - 6 \, a b d n - 3 \, a^{2} d + 3 \, {\left (b^{2} e n x \log \left (c\right ) - b^{2} d n^{2} + a b e n x\right )} \log \left (x\right )^{2} - 6 \, {\left (b^{2} d n + a b d\right )} \log \left (c\right ) + 3 \, {\left (b^{2} e x \log \left (c\right )^{2} - 2 \, b^{2} d n^{2} - 2 \, a b d n + a^{2} e x - 2 \, {\left (b^{2} d n - a b e x\right )} \log \left (c\right )\right )} \log \left (x\right )}{3 \, x} \]

[In]

integrate((e*x+d)*(a+b*log(c*x^n))^2/x^2,x, algorithm="fricas")

[Out]

1/3*(b^2*e*n^2*x*log(x)^3 - 6*b^2*d*n^2 - 3*b^2*d*log(c)^2 - 6*a*b*d*n - 3*a^2*d + 3*(b^2*e*n*x*log(c) - b^2*d
*n^2 + a*b*e*n*x)*log(x)^2 - 6*(b^2*d*n + a*b*d)*log(c) + 3*(b^2*e*x*log(c)^2 - 2*b^2*d*n^2 - 2*a*b*d*n + a^2*
e*x - 2*(b^2*d*n - a*b*e*x)*log(c))*log(x))/x

Sympy [A] (verification not implemented)

Time = 1.82 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.96 \[ \int \frac {(d+e x) \left (a+b \log \left (c x^n\right )\right )^2}{x^2} \, dx=- \frac {a^{2} d}{x} + a^{2} e \log {\left (x \right )} - \frac {2 a b d n}{x} - \frac {2 a b d \log {\left (c x^{n} \right )}}{x} - 2 a b e \left (\begin {cases} - \log {\left (c \right )} \log {\left (x \right )} & \text {for}\: n = 0 \\- \frac {\log {\left (c x^{n} \right )}^{2}}{2 n} & \text {otherwise} \end {cases}\right ) - \frac {2 b^{2} d n^{2}}{x} - \frac {2 b^{2} d n \log {\left (c x^{n} \right )}}{x} - \frac {b^{2} d \log {\left (c x^{n} \right )}^{2}}{x} - b^{2} e \left (\begin {cases} - \log {\left (c \right )}^{2} \log {\left (x \right )} & \text {for}\: n = 0 \\- \frac {\log {\left (c x^{n} \right )}^{3}}{3 n} & \text {otherwise} \end {cases}\right ) \]

[In]

integrate((e*x+d)*(a+b*ln(c*x**n))**2/x**2,x)

[Out]

-a**2*d/x + a**2*e*log(x) - 2*a*b*d*n/x - 2*a*b*d*log(c*x**n)/x - 2*a*b*e*Piecewise((-log(c)*log(x), Eq(n, 0))
, (-log(c*x**n)**2/(2*n), True)) - 2*b**2*d*n**2/x - 2*b**2*d*n*log(c*x**n)/x - b**2*d*log(c*x**n)**2/x - b**2
*e*Piecewise((-log(c)**2*log(x), Eq(n, 0)), (-log(c*x**n)**3/(3*n), True))

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.58 \[ \int \frac {(d+e x) \left (a+b \log \left (c x^n\right )\right )^2}{x^2} \, dx=\frac {b^{2} e \log \left (c x^{n}\right )^{3}}{3 \, n} - 2 \, b^{2} d {\left (\frac {n^{2}}{x} + \frac {n \log \left (c x^{n}\right )}{x}\right )} + \frac {a b e \log \left (c x^{n}\right )^{2}}{n} - \frac {b^{2} d \log \left (c x^{n}\right )^{2}}{x} + a^{2} e \log \left (x\right ) - \frac {2 \, a b d n}{x} - \frac {2 \, a b d \log \left (c x^{n}\right )}{x} - \frac {a^{2} d}{x} \]

[In]

integrate((e*x+d)*(a+b*log(c*x^n))^2/x^2,x, algorithm="maxima")

[Out]

1/3*b^2*e*log(c*x^n)^3/n - 2*b^2*d*(n^2/x + n*log(c*x^n)/x) + a*b*e*log(c*x^n)^2/n - b^2*d*log(c*x^n)^2/x + a^
2*e*log(x) - 2*a*b*d*n/x - 2*a*b*d*log(c*x^n)/x - a^2*d/x

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 162 vs. \(2 (70) = 140\).

Time = 0.33 (sec) , antiderivative size = 162, normalized size of antiderivative = 2.25 \[ \int \frac {(d+e x) \left (a+b \log \left (c x^n\right )\right )^2}{x^2} \, dx=\frac {1}{3} \, b^{2} e n^{2} \log \left (x\right )^{3} + b^{2} e n \log \left (c\right ) \log \left (x\right )^{2} - b^{2} d n^{2} {\left (\frac {\log \left (x\right )^{2}}{x} + \frac {2 \, \log \left (x\right )}{x} + \frac {2}{x}\right )} - 2 \, b^{2} d n {\left (\frac {\log \left (x\right )}{x} + \frac {1}{x}\right )} \log \left (c\right ) + a b e n \log \left (x\right )^{2} + b^{2} e \log \left (c\right )^{2} \log \left ({\left | x \right |}\right ) - 2 \, a b d n {\left (\frac {\log \left (x\right )}{x} + \frac {1}{x}\right )} + 2 \, a b e \log \left (c\right ) \log \left ({\left | x \right |}\right ) - \frac {b^{2} d \log \left (c\right )^{2}}{x} + a^{2} e \log \left ({\left | x \right |}\right ) - \frac {2 \, a b d \log \left (c\right )}{x} - \frac {a^{2} d}{x} \]

[In]

integrate((e*x+d)*(a+b*log(c*x^n))^2/x^2,x, algorithm="giac")

[Out]

1/3*b^2*e*n^2*log(x)^3 + b^2*e*n*log(c)*log(x)^2 - b^2*d*n^2*(log(x)^2/x + 2*log(x)/x + 2/x) - 2*b^2*d*n*(log(
x)/x + 1/x)*log(c) + a*b*e*n*log(x)^2 + b^2*e*log(c)^2*log(abs(x)) - 2*a*b*d*n*(log(x)/x + 1/x) + 2*a*b*e*log(
c)*log(abs(x)) - b^2*d*log(c)^2/x + a^2*e*log(abs(x)) - 2*a*b*d*log(c)/x - a^2*d/x

Mupad [B] (verification not implemented)

Time = 0.43 (sec) , antiderivative size = 138, normalized size of antiderivative = 1.92 \[ \int \frac {(d+e x) \left (a+b \log \left (c x^n\right )\right )^2}{x^2} \, dx=\ln \left (x\right )\,\left (e\,a^2+2\,e\,a\,b\,n+2\,e\,b^2\,n^2\right )-\frac {d\,a^2+2\,d\,a\,b\,n+2\,d\,b^2\,n^2}{x}-{\ln \left (c\,x^n\right )}^2\,\left (\frac {b^2\,d+b^2\,e\,x}{x}-\frac {b\,e\,\left (a+b\,n\right )}{n}\right )-\frac {\ln \left (c\,x^n\right )\,\left (2\,b\,d\,\left (a+b\,n\right )+2\,b\,e\,x\,\left (a+b\,n\right )\right )}{x}+\frac {b^2\,e\,{\ln \left (c\,x^n\right )}^3}{3\,n} \]

[In]

int(((a + b*log(c*x^n))^2*(d + e*x))/x^2,x)

[Out]

log(x)*(a^2*e + 2*b^2*e*n^2 + 2*a*b*e*n) - (a^2*d + 2*b^2*d*n^2 + 2*a*b*d*n)/x - log(c*x^n)^2*((b^2*d + b^2*e*
x)/x - (b*e*(a + b*n))/n) - (log(c*x^n)*(2*b*d*(a + b*n) + 2*b*e*x*(a + b*n)))/x + (b^2*e*log(c*x^n)^3)/(3*n)